package com.bwf.encap;

/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/5/10 13:57
 * @Copyright 博为峰
 */
public class Student extends Person{
    //公开
    public String name;
    //私有
    private int age;

    public void setAge(int age) {
        if (age > 120) {
            System.out.println("无效的年龄");
        } else {
            this.age = age;
        }
    }

    public int getAge() {
        return this.age;
    }
}
